package com.example.blog.dao;

import com.example.blog.entity.PostsInfo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.Map;

/**
 * @ClassName: FoodInfoRespository
 * @Description:

 * @Date 2023/9/9
 * @Version 1.0
 */
@Repository
public interface PostsInfoRepository extends JpaRepository<PostsInfo,String>, JpaSpecificationExecutor<PostsInfo> {

    @Query(value = "select s.* from PostsInfo s",nativeQuery = true,countQuery = "select count(*) from PostsInfo s")
    Page<Map<String, Object>> selectList(Pageable pageable);

    int countByUserId(String userId);
}
